package Forms;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class AboutDialog extends Dialog {

	protected Object result;
	protected Shell shell;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public AboutDialog(Shell parent, int style) {
		super(parent, style);
		setText("SWT Dialog");
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shell = new Shell(getParent(), getStyle());
		shell.setSize(369, 222);
		shell.setText("\u041E \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0435");
		
		Button btnOK = new Button(shell, SWT.NONE);
		btnOK.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				shell.close();
			}
		});
		btnOK.setBounds(140, 158, 75, 25);
		btnOK.setText("OK");
		
		Label lblNeuralForecaser = new Label(shell, SWT.NONE);
		lblNeuralForecaser.setFont(SWTResourceManager.getFont("Segoe UI", 14, SWT.NORMAL));
		lblNeuralForecaser.setBounds(78, 10, 204, 25);
		lblNeuralForecaser.setText("Neural Forecaster v. 1.0");
		
		Label label = new Label(shell, SWT.WRAP);
		label.setBounds(44, 41, 272, 80);
		label.setText("\u041F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u0441\u043A\u0430\u0437\u0430\u043D\u0438\u044F \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439 \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u0438\u0445 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u043D\u0435\u0439\u0440\u043E\u043D\u043D\u044B\u0445 \u0441\u0435\u0442\u0435\u0439. \r\n\u0410\u0434\u0440\u0435\u0441 \u0432 \u0418\u043D\u0442\u0435\u0440\u043D\u0435\u0442: https://code.google.com/p/forecaster-neural/");
		
		Label lblFdnjh = new Label(shell, SWT.WRAP);
		lblFdnjh.setText("\u0410\u0432\u0442\u043E\u0440: \u041D\u0435\u0432\u0435\u0434\u0438\u0446\u0438\u043D \u041D., \u0418\u0412\u0422\u043C-11");
		lblFdnjh.setBounds(159, 127, 182, 25);

	}
}
